package com.objecteffects.template.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import com.objecteffects.template.util.PostsTypeConverter;

import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * @author Rusty Wright
 */
@Entity
public class BlogPostsOffsetEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue
    private Long id;

    @Column(nullable = false)
    private Integer postsOffset;

    @Convert(converter = PostsTypeConverter.class)
    private PostsType postsType;

    public BlogPostsOffsetEntity() {
    }

    public BlogPostsOffsetEntity(final Integer _postsOffset,
        final PostsType _postsType) {
        this.postsOffset = _postsOffset;
        this.postsType = _postsType;
    }

    /**
     * @return the Id
     */
    public final Long getId() {
        return this.id;
    }

    /**
     * @param _id
     *        the id to set
     */
    public final void setId(final Long _id) {
        this.id = _id;
    }

    /**
     * @return the postsOffset
     */
    public final Integer getPostsOffset() {
        return this.postsOffset;
    }

    /**
     * @param _postsOffset
     *        the postsOffset to set
     */
    public final void setPostsOffset(final Integer _postsOffset) {
        this.postsOffset = _postsOffset;
    }

    /**
     * @return the postsType
     */
    public final PostsType getPostsType() {
        return this.postsType;
    }

    /**
     * @param _postsType
     *        the postsType to set
     */
    public final void setPostsType(final PostsType _postsType) {
        this.postsType = _postsType;
    }

    @Override
    public final String toString() {
        return new ToStringBuilder(this).append("id", this.id)
            .append("postsType", this.postsType)
            .append("postsOffset", this.postsOffset).toString();
    }
}
